<template>
    <div class="wrapper">
        <v-header></v-header>
        <v-Sidebar></v-Sidebar>
        <div class="content-box" :class="{'content-collapse': collapse}">
            <v-Tags></v-Tags>
            <div class="content">
                <transition name="move" mode="out-in">
                    <keep-alive :include="tagsList">
                        <router-view></router-view>
                    </keep-alive>
                </transition>
                <el-backtop target=".content"></el-backtop>
            </div>
        </div>
    </div>
</template>
<script>
import bus from "../style/js/bus.js"
import vHeader from "../components/Header";
import vSidebar from "../components/Sidebar"
import vTags from "../components/Tags"
export default {
    data(){
        return{
            tagsList: [],
            collapse: false
        }
    },
    components: {
        vHeader,
        vSidebar,
        vTags
    },
    created(){
        bus.$on('collapse-content', msg => {
            this.collapse = msg;
        }),
        bus.$on('tags', msg => {
            let arr = [];
            for (let i =0, len = msg.length; i < len; i++){
                msg[i].name && arr.push(msg[i].name);
            }
            this.tagList = arr;
        })
    }
}
</script>



